<form name="frm" action="<?php echo $this->site['base_url']?>quiz/save" method="post" enctype="multipart/form-data">
<table class="gioithieu"  style="width:658px" border="0" align="left">
          <tr>
            <td class="gioithieu_title" ><?php echo Kohana::lang('quiz_lang.lbl_title') ?>?</td>
          </tr>
		  <tr>
            <td style="padding-top:10px"><?php echo Kohana::lang('quiz_lang.lbl_content') ?></td>
          </tr>
		  <tr>
            <td  align="left" style="padding-left:25px">
            
				<?php 
				$i=0;
				foreach($mlistQuestions as $listQuestions) {
				$i++;
				?>
				<p class="desctext"><span class="schedhead"><?php echo $i.'.&nbsp;'; echo $listQuestions['questions_title']?></span><br>
				<?php foreach($mlistAnsers as $list){
					if($list['questions_id']==$listQuestions['questions_id']){
				?>
					<input type="radio" name="txt_q<?php echo $i?>" value="<?php echo $list['answers_id']?>"><?php echo $list['answers_title']?><br>

					<?php }
					}
					?>
				
				<hr size="1"  class="quiz">
				<?php 
				}
				 ?>
                
	 </td></tr>
	 <tr><td align="left" >
		<table border="0" cellspacing="0" cellpadding="2" align="center">
		<tr> 
		<td valign="top" ><strong><?php echo Kohana::lang('quiz_lang.lbl_firstname') ?></strong>
		
				<input type="text" name="FirstName" size="24">			</td>
		<td valign="top" width="190"><strong><?php echo Kohana::lang('quiz_lang.lbl_lastname') ?></strong><br>
				<input type="text" name="LastName" size="24">			</td>
		<td valign="top" width="190"><strong><?php echo Kohana::lang('quiz_lang.lbl_jobtitle') ?></strong><br>
				<input type="text" name="jobtitle" size="13">			</td>
		</tr>
		
		<tr> 
		<td colspan="3" ><strong><?php echo Kohana::lang('quiz_lang.lbl_organization') ?></strong><br>
		
				<input type="text" name="organization" size="62" maxlength="100">
				<br>			</td>
		</tr>
		
		
		<tr> 
		<td colspan="3" valign="top"><strong><?php echo Kohana::lang('quiz_lang.lbl_organization_address') ?></strong><br>
				<input type="text" name="address" size="62" maxlength="200">			</td>
		</tr>
		
		<tr> 
		<td valign="top" width="190"><strong><?php echo Kohana::lang('quiz_lang.lbl_city') ?></strong><br>
				<input type="text" name="city" size="24" maxlength="50">			</td>
		<td valign="top" width="190"><?php echo Kohana::lang('quiz_lang.lbl_phone') ?><br />
          <input type="text" name="phone" size="24" maxlength="55" />
          <br></td>
		<td valign="top" width="190"><strong>E-mail</strong><br />
          <input type="text" name="Email" size="24" /></td>
		</tr>
		
		<td valign="top" width="190" colspan="3">
		  <p class="desctext"></td>
		</tr>
		<tr> 
		<td colspan="3"><a href="javascript: submitThisForm();"><u><?php echo Kohana::lang('quiz_lang.lbl_result') ?><br></a></td>
		</tr>
		</table>
	 </td>
	 </tr>
     
</table>
 </form>
	<script language="JavaScript" type="text/JavaScript">
<!--
function changeimage(imgx,placex)  { 
		if (document.images) { 
				document.images[placex].src = eval(imgx + ".src");
		}
}

function MM_findObj(n, d) { 
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { 
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
		if (val) { nm=val.name; if ((val=val.value)!="") {
			if (test.indexOf('isEmail')!=-1) {
				if (val.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) errors+='- '+nm+' must contain a valid e-mail address.\n';
			} else if (test!='R') { num = parseFloat(val);
				if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
				if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
					min=test.substring(8,p); max=test.substring(p+1);
					if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
		} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
	} if (errors) alert('The following error(s) occurred:\n'+errors);
	document.MM_returnValue = (errors == '');
}
//-->	
</script>
 <script language="JavaScript">
		<!--
		function valButton(btn) {
			var cnt = -1;
			for (var i=btn.length-1; i > -1; i--) {
					if (btn[i].checked) {cnt = i; i = -1;}
			}
			if (cnt > -1) return btn[cnt].value;
			else return null;
		}
    
		function Assessment(num) {
			var errors='';
			for (var i=1; i<=num; i++)
			{
				if (valButton(eval("document.frm.txt_q" + i)) == null) errors += '\n'+i;
			}
			if (errors){
			alert('Please answer the following questions:'+errors);
			//return true;
			}
			document.qerror = (errors == '');
		}
		
		function submitThisForm() { //v4.0
			Assessment(<?php echo count($mlistQuestions)?>);
			MM_validateForm('FirstName','','R','LastName','','R','jobtitle','','R','organization','','R','address','','R','city','','R','Email','','RisEmail');
			if(document.qerror & document.MM_returnValue) document.frm.submit();
			else return;
		}
		
		//-->
		</script>